<template>
	<view v-if="showPage1">
		<page-container :show="showPage1" :overlay="false" @beforeleave="beforeleave('showPage1')"></page-container>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showPage1: true,   //一开始设置为显示
			}
		},
		methods: {
			beforeleave(){
					this.showPage1 = false  //这个很重要，一定要先把弹框删除掉
					uni.showModal({
						title: `确定要退出商城吗`,
						success: (e)=>{
							if(e.confirm) {
								uni.redirectTo({
									url: '/pages/index/index?index=2'
								})
							}else {
								//点取消，生成新的弹框
								this.showPage1 = true
							}
						},
					})
				},
			
		}
	}
</script>

<style>
</style>